<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue 示例</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
    <style>
        .test {
            padding: 20px;
            width: 540px;
            height: 540px;
            background-color: #c7389d;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="test">
        <div>标题</div>
        <div id="display">{{ displayMessage }}</div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            displayMessage: 'null'
        },
        mounted() {
            // 获取 URL 中的参数
            const queryString = window.location.search;
            const urlParams = new URLSearchParams(queryString);
            const paramsString = urlParams.get('data');
            const data = JSON.parse(decodeURIComponent(paramsString));
            console.log(data);
            // 更新显示消息
            if (data) {
                this.displayMessage = `传入的参数: ${data.id}`;
            }
        }
    });
</script>
</body>
</html>
